package gizwits.overseaair.way.userGroup;

import java.util.HashMap;
import java.util.Map;

public class Query {

	public static final String uri = "/api/userGroup/getD";
	
	public static void main(String[] args) throws InterruptedException {
		Map<String, Object> params = new HashMap<>();
		params.put("userId", "dfbe7fd125174baab19b587b1d94ecf3");
		//for(int i=0;i<20;i++){
			//Thread.sleep(3*1000);
			//HttpKit.post(Address.air2+uri, params);
		//}
			//System.out.println(System.currentTimeMillis());
			
//			SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
//			System.out.println(sdf.format(new Date(1480471622535l)));
//			System.out.println(sdf.format(new Date(1480471248812l)));
		StringBuffer sbf = new StringBuffer();
			String s = "";
			System.out.println(sbf.toString().split(",").length);
			
			System.out.println(parseCid("C0E4772D01000110"));
	}
	
	
	public static long parseCid(String cidStr) {
		if(cidStr.length()!=16){
			throw new RuntimeException();
		}
		byte[] bs = new byte[8];
		for(int i=0;i<8;i++){
			bs[i] = (byte)Integer.parseInt(cidStr.substring(i*2, (i+1)*2), 16);
		}
		return toLongOfLittle(bs, 0, 8);
	}
	
	/**
	 * 【小端格式的字节数组】转【数字】
	 */
	public static long toLongOfLittle(byte[] bs,int start,int len){
		long num = 0;
		for(int i=0;i<len;i++){
			num = num | ((long)(bs[i+start] & 0xff) << i * 8);
		}
	    return num;  
	}

}
